package com.jic.product.store;

import com.jic.common.base.vo.RestResult;
import com.jic.product.store.request.*;
import com.jic.product.store.response.MStoreResponse;
import com.jic.product.store.response.ProductCommentResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;


/**
 * @date: 2020-4-28 10:36:44
 * @remark: 商品后台管理系统的服务接口
 * <p>
 * feignClient  使用方法:
 * <p>
 * 1.服务提供者编写 FeignClient 属性 name对应注册中心服务Id path为统一前缀  url可以直接指定调用地址（调试用）
 * 2.客户端需要在启动类上加上@EnableFeignClients注解
 * 3.如果通过feignClient调用超时，请设置
 * ribbon:
 * ReadTimeout: 3000
 * ConnectTimeout: 3000
 * 4.客户端依赖该jic-feign-common,在调用处@Resource注解注入 即可调用
 */
@Api(value = "库存中心-提供内部调用-feign", tags = "库存中心-提供内部调用-feign")
@FeignClient(name = "jic-product", path = "/mStoreManage")
public interface MStoreApi {
    @PostMapping("/frozen")
    RestResult<Boolean> frozen(@RequestBody MStoreFrozenRequest request);


    @PostMapping("/submit")
    RestResult<Boolean> submit(@Validated @RequestBody MStoreSubmitRequest request) ;

    @PostMapping("/listMStoreInfoByOrderInfo")
    RestResult<List<MStoreResponse>> listMStoreInfoByOrderInfo(@RequestBody MStoreQueryRequest request) ;

    /**
     * 获取可售数量最多的实体仓列表;
     * @param request 请求参数
     * @return MStoreResponse 响应参数
     * author taozhouchuan
     * @date 2020-4-28 20:14:23
     */
    @PostMapping("/maxAvailable")
    RestResult<MStoreResponse> listMStoreOfMaxAvailable(@RequestBody MStoreQueryRequest request) ;

    /**
     * 获取当天发货量最少的的实体仓列表;
     * @param request 请求参数
     * @return MStoreResponse 响应参数
     * author taozhouchuan
     * @date 2020-4-28 20:14:23
     */
    @PostMapping("/minDelivery")
    RestResult<MStoreResponse> listStoreOfMinDelivery(@RequestBody MStoreQueryRequest request) ;

    /**
     * 商家收货同步库存接口
     * @param request
     * @return
     */
    @PostMapping("/syncStock")
    RestResult<Boolean> syncStock(@RequestBody MStoreShopSyncStockRequest request);

    /**
     * 根据商家编码查询实体仓 不存在则创建
     * @param request
     * @return
     */
    @PostMapping("/getStoreByMerchantCode")
    RestResult<MStore> getStoreByMerchantCode(@RequestBody MStoreReq request);

    @PostMapping("getProductCommentByOrderNo")
    RestResult<ProductCommentResponse> getProductCommentByOrderNo(@RequestBody ProductCommentRequest productCommentRequest);

}
